package com.sunwayworld.basemodule.rm.train.examtmpl.resource.impl;

import java.util.ArrayList;

import com.sunwayworld.basemodule.rm.train.examtmpl.bean.LimsCoreExamTmplBean;
import com.sunwayworld.basemodule.rm.train.examtmpl.resource.LimsCoreExamTmplResource;
import com.sunwayworld.basemodule.rm.train.examtmpl.service.LimsCoreExamTmplService;
import com.sunwayworld.basemodule.rm.train.examtmpl.validator.LimsCoreExamTmplDeactivatableValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;


import com.sunwayworld.framework.log.annotation.Log;
import com.sunwayworld.framework.log.annotation.LogModule;
import com.sunwayworld.framework.log.annotation.LogType;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;
import com.sunwayworld.framework.restful.data.RestValidationResultBean;
import com.sunwayworld.framework.spring.annotation.GikamBean;
import com.sunwayworld.framework.support.activatable.resource.AbstractGenericActivatableResource;
import com.sunwayworld.framework.support.base.resource.AbstractGenericResource;
import com.sunwayworld.framework.support.choosable.resource.AbstractGenericChoosableResource;
import com.sunwayworld.framework.validator.data.annotation.ValidateDataWith;

@LogModule("试卷模板")
@RestController
@GikamBean
public class LimsCoreExamTmplResourceImpl implements LimsCoreExamTmplResource,
                                                 AbstractGenericResource<LimsCoreExamTmplService, LimsCoreExamTmplBean, Long>,
                                                 AbstractGenericChoosableResource<LimsCoreExamTmplService, LimsCoreExamTmplBean, Long>,
                                                 AbstractGenericActivatableResource<LimsCoreExamTmplService, LimsCoreExamTmplBean, Long> {

    @Autowired
    private LimsCoreExamTmplService limsCoreExamTmplService;
    
    @Override
    public LimsCoreExamTmplService getService() {
        return limsCoreExamTmplService;
    }

    @Override
    @Log(value = "复制试卷模板", type = LogType.INSERT)
    public ArrayList<Long> clone(RestJsonWrapperBean wrapper) {
        return (ArrayList<Long>) limsCoreExamTmplService.clone(wrapper);
    }
    
    @Override
    @Log(value = "停用试卷模板", type = LogType.INSERT)
    @ValidateDataWith(LimsCoreExamTmplDeactivatableValidator.class)
    public void deactivate(RestJsonWrapperBean wrapper) {
        limsCoreExamTmplService.deactivate(wrapper);
    }
    
    @Log(value = "试卷模板删除校验", type = LogType.VALIDATE)
    public RestValidationResultBean deleteValidate(RestJsonWrapperBean wrapper) {
        return getService().deleteValidate(wrapper);
    }
}